﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SmartMathLibrary.Transformation
{
    /// <summary>
    /// This class descripes the nine parameters of an affintransformation, which includes the
    /// translation, rotation and scaling of all three axis.
    /// </summary>
    [Serializable]
    public class AffinTransformationParameters : IAffinTransformationParameters
    {
        /// <summary>
        /// The scalefactor for the x axis
        /// </summary>
        private double scaleX;

        /// <summary>
        /// The scalefactor for the y axis
        /// </summary>
        private double scaleY;

        /// <summary>
        /// The scalefactor for the z axis
        /// </summary>
        private double scaleZ;

        /// <summary>
        /// The rotationfactor for the x axis.
        /// </summary>
        private double rotationX;

        /// <summary>
        /// The rotationfactor for the y axis.
        /// </summary>
        private double rotationY;

        /// <summary>
        /// The rotationfactor for the z axis.
        /// </summary>
        private double rotationZ;

        /// <summary>
        /// The translationvalue for the x axis.
        /// </summary>
        private double translationX;

        /// <summary>
        /// The translationvalue for the y axis.
        /// </summary>
        private double translationY;

        /// <summary>
        /// The translationvalue for the z axis.
        /// </summary>
        private double translationZ;

        /// <summary>
        /// Initializes a new instance of the <see cref="AffinTransformationParameters"/> class.
        /// </summary>
        public AffinTransformationParameters()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AffinTransformationParameters"/> class.
        /// </summary>
        /// <param name="parameters">The transformationparameters to clone.</param>
        public AffinTransformationParameters(AffinTransformationParameters parameters)
        {
            if (parameters == (AffinTransformationParameters) null)
            {
                throw new ArgumentNullException("parameters");
            }

            this.scaleX = parameters.ScaleX;
            this.scaleY = parameters.ScaleY;
            this.scaleZ = parameters.ScaleZ;
            this.rotationX = parameters.RotationX;
            this.rotationY = parameters.RotationY;
            this.rotationZ = parameters.RotationZ;
            this.translationX = parameters.TranslationX;
            this.translationY = parameters.TranslationY;
            this.translationZ = parameters.TranslationZ;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AffinTransformationParameters"/> class.
        /// </summary>
        /// <param name="scaleX">The scalefactor of the x axis.</param>
        /// <param name="scaleY">The scalefactor of the y axis.</param>
        /// <param name="scaleZ">The scalefactor of the z axis.</param>
        /// <param name="rotationX">The rotationfactor for the x axis.</param>
        /// <param name="rotationY">The rotationfactor for the y axis.</param>
        /// <param name="rotationZ">The rotationfactor for the z axis.</param>
        /// <param name="translationX">The translationvalue for the x axis.</param>
        /// <param name="translationY">The translationvalue for the y axis.</param>
        /// <param name="translationZ">The translationvalue for the z axis.</param>
        public AffinTransformationParameters(double scaleX, double scaleY, double scaleZ, double rotationX,
                                             double rotationY,
                                             double rotationZ, double translationX, double translationY,
                                             double translationZ)
        {
            this.scaleX = scaleX;
            this.scaleY = scaleY;
            this.scaleZ = scaleZ;
            this.rotationX = rotationX;
            this.rotationY = rotationY;
            this.rotationZ = rotationZ;
            this.translationX = translationX;
            this.translationY = translationY;
            this.translationZ = translationZ;
        }

        /// <summary>
        /// Gets or sets the scale of the x axis.
        /// </summary>
        /// <value>The scale of the x axis.</value>
        public double ScaleX
        {
            get { return this.scaleX; }
            set { this.scaleX = value; }
        }

        /// <summary>
        /// Gets or sets the of the y axis.
        /// </summary>
        /// <value>The scale of the y axis.</value>
        public double ScaleY
        {
            get { return this.scaleY; }
            set { this.scaleY = value; }
        }

        /// <summary>
        /// Gets or sets the of the z axis.
        /// </summary>
        /// <value>The scale of the z axis.</value>
        public double ScaleZ
        {
            get { return this.scaleZ; }
            set { this.scaleZ = value; }
        }

        /// <summary>
        /// Gets or sets the rotationfactor for the x axis.
        /// </summary>
        /// <value>The rotationfactor for the x axis.</value>
        public double RotationX
        {
            get { return this.rotationX; }
            set { this.rotationX = value; }
        }

        /// <summary>
        /// Gets or sets the rotationfactor for the y axis.
        /// </summary>
        /// <value>The rotationfactor for the y axis.</value>
        public double RotationY
        {
            get { return this.rotationY; }
            set { this.rotationY = value; }
        }

        /// <summary>
        /// Gets or sets the rotationfactor for the z axis.
        /// </summary>
        /// <value>The rotationfactor for the z axis.</value>
        public double RotationZ
        {
            get { return this.rotationZ; }
            set { this.rotationZ = value; }
        }

        /// <summary>
        /// Gets or sets the translationvalue for the x axis.
        /// </summary>
        /// <value>The translationvalue for the x axis.</value>
        public double TranslationX
        {
            get { return this.translationX; }
            set { this.translationX = value; }
        }

        /// <summary>
        /// Gets or sets the translationvalue for the y axis.
        /// </summary>
        /// <value>The translationvalue for the y axis.</value>
        public double TranslationY
        {
            get { return this.translationY; }
            set { this.translationY = value; }
        }

        /// <summary>
        /// Gets or sets the translationvalue for the z axis.
        /// </summary>
        /// <value>The translationvalue for the z axis.</value>
        public double TranslationZ
        {
            get { return this.translationZ; }
            set { this.translationZ = value; }
        }
    }
}